home *** CD-ROM | disk | FTP | other *** search
Text File | 1991-10-04 | 2.5 KB | 82 lines | [TEXT/dIsR] |
- -- UTexas CS Dept. 2400 Baud login script.
-
- -- A complicated example.
-
- -- To use 1200, remove the "send break". And set speed to 1200
-
- -- The script tries to get the modem's attention and dial, even if it has
- -- to hang up to do it. It uses timeouts to recover from problems.
- -- Problems after connect are assumed to be due to line noise, so it
- -- hangs up and dials again in hope of a cleaner line.
-
- -- You need to set the variable for your username in state init.
-
- script cs
-
- state init
- set port modem; -- These sets are not needed.
- set speed 2400; -- The values are the defaults.
- set databits 8; -- And better to use settings file
-
- setvar USERNAME "newton"; -- We get this now, so user can walk away.
- input PASSWORD; -- You could hardwire this also.
-
- display "Beginning UT CS login script...";
- next ModemReady;
- end; -- init
-
- state ModemReady -- Be sure we have modem's attention
- send "\r"; send "AT\r";
- select
- "OK" : next Dial;
- timeout 3 :
- end;
- send "\r"; send "AT\r"; -- try again
- select
- "OK" : next Dial;
- timeout 3 : next HangUp; -- failed again, maybe hangup
- end;
- end; -- ModemReady
-
- state HangUp -- Hang up a Hayes modem
- send ""; send "+++"; -- First send is for a delay
- select
- "OK" : send "ATH\r"; next ModemReady;
- timeout 3 :
- end;
- send ""; send "+++"; -- try again
- select
- "OK" : send "ATH\r"; next ModemReady;
- timeout 3 : display "Hangup timeout";
- end;
- send "\r"; send "ATH\r"; -- Maybe we are talking to modem somehow
- next ModemReady;
- end; -- HangUp
-
- state Dial
- send "ATDT4718454\r"; -- The system's phone number
- select
- "CONNECT" : next GotIt;
- "BUSY" : next ModemReady;
- "NO CARRIER" : next ModemReady;
- timeout 22 : display "Dial timeout!"; next ModemReady;
- end;
- end; -- Dial
-
- state GotIt
- delay 1;
- send break; -- UNIX host needs a break to switch to 2400 baud
- select
- "login:" :
- timeout 60 : display "login timeout!"; next HangUp;
- end;
- send USERNAME; send "\r"; -- Your username and return
- select
- "Password:" :
- timeout 60 : display "password timeout!"; next HangUp;
- end;
- send PASSWORD; send "\r"; -- Your password and return
- end; -- GotIt
-
- end; -- UTlogin
-